<?php

namespace Database\Factories;

use App\Models\File;
use Illuminate\Database\Eloquent\Factories\Factory;

class FileFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = File::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        $imageArray = ['jpeg', 'png', 'jpg', 'webp'];
        $width = $this->faker->numberBetween(100, 1000);
        $height = $this->faker->numberBetween(100, 1000);
        $type = $this->faker->randomElement($imageArray);
        return [
            'width' => $width,
            'height' => $height,
            'size' => $this->faker->numberBetween(10000, 100000),
            'type' => $type,
            'file' => "/random_file?width=$width&height=$height&type=$type"
        ];
    }
}
